package com.itheima.dubbo.web;

import com.itheima.dubbo.UserFace;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController()
@RequestMapping("user")
public class UserController {
    //@DubboReference(timeout = 1500)
    //@DubboReference(methods ={@Method(name="hello",timeout = 1500)} )
   // @DubboReference(retries = 5)
    @DubboReference(loadbalance ="roundrobin" )//轮询
    UserFace userFace;
    @GetMapping("hello")
    public String hello(String userName){
        RpcContext.getContext().setAttachment("xiao","阿xiaoxiaoxiaoxiao");
        return userFace.hello(userName);
    }
}
